package com.ruibang.glass.job.service;

import com.ruibang.glass.job.feign.EquipmentApi;
import com.teaming.cloud.framework2.elastic.job3.annotation.ElasticJobScheduler;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 基于注解形式script job
 *
 * 仪表台账 通知按周
 */
@Service
@ElasticJobScheduler(cron = "30 */10 * * * ?", shardingTotalCount = 1, name = "EqTBTZWeekDataElasticJob",
        shardingItemParameters = "0=0", jobParameters = "parameter")
@Slf4j
public class EqTBTZWeekDataElasticJob implements SimpleJob {
    @Autowired
    private EquipmentApi equipmentApi;

    public void updateStatusByWeekTime() {
        equipmentApi.updateStatusByWeekTime();
    }

    @Override
    public void execute(ShardingContext shardingContext) {
        log.info("===========================定时任务点仪表台账建任务开始按周执行====================");
        updateStatusByWeekTime();
        log.info("===========================定时任务点仪表台账建任务开始按周执行====================");
    }
}
